/*
报名参赛 报名选择
DepartMentChoice.js*/
import React, { PropTypes, Component } from 'react';
import { autobind } from 'core-decorators';
import { Checkbox, Row, Col,Radio  } from 'antd';
import { connect } from 'react-redux';
const RadioGroup = Radio.Group;
class DepartMentChoice extends Component {
	
	onChange=(e)=> {
		if(e.target.value == 'true'){
			this.props.dispatch({
	  		type:'privateGame/setState',
	  		payload:{
	  			"isCustom":true
	  		}
	  	})
		}else{
			this.props.dispatch({
	  		type:'privateGame/setState',
	  		payload:{
	  			"enrollDivisionId":e.target.value,
	  			"isCustom":false
	  		}
	  	})
		}
  	
	}
  
	render(){
		const {departMentArr}=this.props;
		console.log('sss',this.props)
		return(
			<div>
				<RadioGroup  style={{ width: '100%' }} onChange={this.onChange}>
			    	{
			    		departMentArr?departMentArr.map((item,i)=>{
			    			return (
			    				<div key={i}>
			    					<Col span={12} key={i}>
				    					<Radio value={item.id}>{item.name}</Radio>
				    				</Col>
			    				</div>
				    			
			    			)
			    		}):null
			    	}
			  </RadioGroup>
			</div>
		)
	}
}


export default connect(({privateGame}) =>({privateGame}))(DepartMentChoice)